<style>
    #datatable tr >th,td {
        border: 1px solid #ddd;
    }
    #datatable tr >th {
        text-align: center;
    }
    .numShow {
        text-align: right;
    }
    .city {
        cursor:pointer;
        text-align: center;
    }
</style>
<table style="width:100%;">
    <tr>
        <td>
            <div class="form-inline" style="padding: 10px;background-color: #bdf3dc;">
                {#<div class="form-group">#}
                {#<label>选择区域：</label>#}
                {#<select class="form-control" name="school_area" id="school_area" style="width: 140px;">#}

                {#</select>#}
                {#</div>#}
                <a  id="bt_view_usage" download="{{ fileName }}.xls" href="#"  class="btn btn-success btn-sm" onclick="return ExcellentExport.excel(this, 'datatable', 'xh');" style="margin-left: 15px;width: 80px;">导出</a>
            </div>
        </td>
    </tr>
    <tr style="height: 100%;width:100%;">
        <td valign="top" style="border: 0px">
            <table class="table table-hover" id="datatable" >
                <tbody>
                <tr class="info">
                    <th style="width: 30%;">学校名称</th>
                    <th style="width: 15%;">教师数</th>
                    <th style="width: 10%">年级</th>
                    <th style="width: 15%">班级</th>
                    <th style="width: 15%;">班级数</th>
                    <th style="width: 15%;">学生数</th>
                </tr>
                {% if info is defined %}
                    {% for index,item in info %}
                        {% if item['schoolName'] == '合计'  %}
                            <tr>
                                <td>{{ item['schoolName'] }}</td>
                                <td>{{ item['tchNum'] }}</td>
                                <td colspan="3" style="text-align: right">{{ item['classNum'] }}</td>
                                <td style="text-align: right">{{ item['stuNum'] }}</td>
                            </tr>
                            {% else %}
                                {% if item['grade'] | length > 0 %}
                                    {% for gradeId,gradeDetail in item['grade'] %}
                                        <tr>
                                            {% if loop.first %}
                                                <td title="{{ item['schoolId'] }}" rowspan="{{ item['grade'] | length }}">{{ item['schoolName'] }}</td>
                                                <td rowspan="{{ item['grade'] | length }}">{{ item['tchNum'] }}</td>
                                            {% endif %}
                                            <td>{{ gradeId }}</td>
                                            <td>{{ gradeDetail['classes'] }}</td>
                                            <td class="numShow">{{ gradeDetail['classesNum'] }}</td>
                                            <td class="numShow">{{ gradeDetail['stuNum'] }}</td>
                                        </tr>
                                    {% endfor %}
                                {% else %}
                                    <tr>
                                        <td >{{ item['schoolName'] }}</td>
                                        <td colspan="5">无数据</td>
                                    </tr>
                                {% endif %}
                        {% endif %}

                    {% endfor %}
                {% endif %}
                </tbody>
            </table>
        </td>
    </tr>
</table>